Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mm: allocate for redemptions when fee asset mismatch #2863

Merged
merged 21 commits into from
Jul 18, 2024

Conversation

buck54321
Copy link
Member

We weren't properly reserving redemption fees for evm assets when the counter-asset didn't share a fee asset.

@buck54321 buck54321 force-pushed the utxo-to-evm-redemption-fee-alloc branch 2 times, most recently from bb844fd to ea5a479 Compare July 12, 2024 13:08
@buck54321 buck54321 force-pushed the utxo-to-evm-redemption-fee-alloc branch 2 times, most recently from eae3899 to eb26483 Compare July 15, 2024 17:02
Comment on lines +1017 to +1013
const baseBookingFees = (baseBookingFeesPerLot * baseLots) * baseReservesFactor
const baseRedeemFees = (baseRedeemReservesPerLot * quoteLots) * quoteReservesFactor
const quoteBookingFees = (quoteBookingFeesPerLot * quoteLots) * quoteReservesFactor
const quoteRedeemFees = (quoteRedeemReservesPerLot * baseLots) * baseReservesFactor
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm scaling the booking fees to reserve for the order reserves as well, because the fees reserved for an order are not necessarily released as soon as the order matches. But for the maker, the fees reserved for the swap actually should be released immediately, since the maker should broadcast its swap right away. And since for arb-mm, we usually expect to be the maker, we should maybe only scale the fees reserved for redemptions. I'm gonna leave it for now though, since it's not actually impossible that we'd be the taker.

@buck54321 buck54321 force-pushed the utxo-to-evm-redemption-fee-alloc branch from eb26483 to 41a9473 Compare July 15, 2024 20:04
@buck54321 buck54321 force-pushed the utxo-to-evm-redemption-fee-alloc branch from 41a9473 to d4d07ac Compare July 18, 2024 16:48
@buck54321 buck54321 force-pushed the utxo-to-evm-redemption-fee-alloc branch from 9cfc7d5 to 50be3c5 Compare July 18, 2024 19:27
@buck54321 buck54321 merged commit d0cb5c4 into decred:master Jul 18, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants